import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:live_music/components/common/FilePreviewPage.dart';
import 'package:live_music/models/moment_detail_model.dart';

class MomentFileDetail extends StatelessWidget {
  MomentFileDetail({Key key, this.momentId, this.fileItem}) : super(key: key);
  final int momentId;
  final FileClass fileItem;
  @override
  Widget build(BuildContext context) {
    return Container(
        height: 150,
        width: MediaQuery.of(context).size.width,
        child: Container(
          margin: const EdgeInsets.only(top: 8),
          padding: EdgeInsets.all(12),
          color: Colors.grey[100],
          child: ClipRRect(
              borderRadius: BorderRadius.circular(8),
              child: Row(children: [
                Container(
                  margin: const EdgeInsets.only(right: 4),
                  child: InkWell(
                      onTap: () async {
                        Get.to(FilePreviewPage(
                            momentId: momentId, fileItem: fileItem));
                      },
                      child: SizedBox(
                          width: 86,
                          height: 96,
                          child: ClipRRect(
                              borderRadius: BorderRadius.circular(4),
                              child:
                                  Image.asset('assets/images/icons/pdf.png')))),
                ),
                Expanded(
                    flex: 1,
                    child: Column(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [
                          Container(
                            margin: const EdgeInsets.only(bottom: 24, top: 18),
                            alignment: Alignment.centerLeft,
                            child: SizedBox(
                              child: Text(fileItem.title,
                                  overflow: TextOverflow.ellipsis,
                                  maxLines: 2,
                                  style: TextStyle(
                                    fontSize: 14,
                                    color: Colors.grey[800],
                                    fontWeight: FontWeight.bold,
                                  )),
                            ),
                          ),
                          Container(
                              alignment: Alignment.centerRight,
                              margin:
                                  const EdgeInsets.only(bottom: 10, right: 12),
                              child: Row(
                                  mainAxisAlignment: MainAxisAlignment.end,
                                  children: [
                                    SizedBox(
                                        child: Text(fileItem.size,
                                            style: TextStyle(
                                              color: Colors.grey,
                                            )))
                                  ])),
                        ]))
              ])),
        ));
  }
}
